package org.vaadin.example.cfg;

import com.mybatisflex.core.audit.AuditManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyBatisFlexConfiguration {

    private static final Logger log = LoggerFactory.getLogger(MyBatisFlexConfiguration.class);

    public MyBatisFlexConfiguration() {
        AuditManager.setAuditEnable(true);
        AuditManager.setMessageCollector(a->{
            log.info("{},{}ms",a.getFullSql(),a.getElapsedTime());
        });
    }
}
